package com.wa.controller;

import com.wa.validator.LoginVo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.method.support.ModelAndViewContainer;

import javax.servlet.http.HttpServletRequest;

/** 参数解析测试
 * @author gary
 * @date 2022年01月06日 16:04
 *  解析器这里调用 {@link org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod#getMethodArgumentValues}
 */
@Controller
@RequestMapping("/params")
public class ParamsController {

    /**
     *  127.0.0.1:8080/httpServletRequest
     *  {@link org.springframework.web.servlet.mvc.method.annotation.ServletRequestMethodArgumentResolver#supportsParameter}
     */
    @RequestMapping("/httpServletRequest")
    @ResponseBody
    public String httpServletRequest(HttpServletRequest request){
        return "123456";
    }

    /**
     *  127.0.0.1:8080/test/beanClass
     *  支持类型
     *  {@link org.springframework.web.servlet.mvc.method.annotation.ServletModelAttributeMethodProcessor#supportsParameter}
     *  解析
     *  {@link org.springframework.web.servlet.mvc.method.annotation.ServletModelAttributeMethodProcessor#resolveArgument}
     */
    @RequestMapping("/beanClass")
    @ResponseBody
    public LoginVo beanClass(LoginVo loginVo){
        return loginVo;
    }
}
